﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;

namespace Hibiku.ValidationRules
{
    public class TweetValidationRule : ValidationRule
    {
        public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo)
        {
            var test = value as string;

            if (string.IsNullOrEmpty(test))
            {
                return new ValidationResult(false, "Empty string");
            }
            else
            {
                if (test.Length > 140)
                {
                    return new ValidationResult(false, "Too long - 140 character limit");
                }
                else
                {
                    return new ValidationResult(true, null);
                }
            }
        }
    }
}
